contain_name="natfrp-service"
DIR=$( dirname "$(readlink -f  ${BASH_SOURCE[0]})" )
subs=$(ls -1 ${DIR}/dockerconfig)
for index in ${!subs[@]}
do
  sub=${subs[index]}
  res=$(expr 2 + $index)
  docker ps -a | grep ${contain_name}_${sub}
  if [[ $? -eq 1 ]]
  then
    docker run -d --restart=always --pull=always --hostname zxhtom \
      -p 1410${res}:4101 \
      --name=${contain_name}_${sub%%.*} \
      -v ${DIR}/dockerconfig/${sub}:/run/config.json \
      natfrp/launcher
  else
    docker restart ${contain_name}_${sub}
  fi
done
